<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/static/css/bootstrap.min.css">
    <script src="/static/js/jquery.min.js"></script>
    <script src="/static/js/popper.min.js"></script>
    <script src="/static/js/bootstrap.min.js"></script>
    <title>sjg logdetail</title>
</head>
<body>
<nav class="navbar navbar-expand-sm bg-dark navbar-dark" id="mynav">
</nav>
<div class="container-fluid">
    <br /><br />
    <div class="row">
        <div class="col">
            <pre id="logs_result" style="white-space: pre-wrap;word-wrap: break-word;"></pre>
        </div>
    </div>
</div>
<script src="/static/js/thesame.js"></script>
<script type="text/javascript">
    $('#logs_result').text('日志加载中。。。');
    mysearch = window.location.search;
    mysearch = mysearch.replace(/^\?/,'');
    myparam = mysearch.split('=');
    if(myparam[0]=='id'){ id = myparam[1]}
    var interid = setInterval(function(){
          $.ajax({
            url: '/action_mylog/getlog_by_id/',
            type: 'get',
            cache: false,
            data: { id: id, },
            success: function (logdata) {
                tmpresult = JSON.parse(logdata);
                $('#logs_result').text(tmpresult['result']);
                if(tmpresult['writeresult'] == 'done'){
                  console.log('clearInterval');
                  clearInterval(interid);
                }
            },error: function(){
                $('#logs_result').html('运行出错');
                console.log('clearInterval');
                clearInterval(interid);
            }
        });
    }, 2000);
</script>
</body>
</html>